package com.kingsoft.dc.khaos.extender.meta.impl;

import com.alibaba.fastjson.JSON;
import com.kingsoft.dc.khaos.extender.meta.model.ds.Connect;
import com.kingsoft.dc.khaos.extender.meta.model.ds.CosConnect;
import com.kingsoft.dc.khaos.extender.meta.utils.RSAEncrypt;

/**
 * Created by jing on 19/6/27.
 */
public class CosDmMetaImpl extends DmMetaImpl {
    @Override
    public Connect decryptDatasourceConnectSecret(String config) {
        CosConnect connect = JSON.parseObject(config, CosConnect.class);
        try {
            connect.setAccessKeySecret(RSAEncrypt.decryptByRSAPassWord(connect.getAccessKeySecret()));
        } catch (Exception e) {
            e.printStackTrace();

        }
        return connect;
    }
}
